<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title><s:text name="计量单位"></s:text></title>
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="this is my page">
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="css/public.css">
		<script type="text/javascript" src="js/sorttable.js"></script>
		<script language="JavaScript" src="js/public.js"></script>
		<script type="text/javascript" src="js/date1.js"></script>
		<script type="text/javascript" src="js/validate.js"></script>
		<script type="text/javascript">
	function openWin(link, name, width, height, scroll) {
		var sb = scroll == "1" ? "1" : "0";
		var l = (screen.width - width) / 2;
		var t = (screen.height - height) / 2;
		var sFeatures = "left=" + l + ",top=" + t + ",height=" + height
				+ ",width=" + width + ",center=1,scrollbars=" + sb
				+ ",status=0,directories=0,channelmode=0";
		var openwin = window.open(link, name, sFeatures);
		if (!openwin.opener) {
			openwin.opener = self;
		}
		openwin.focus();
	}
	function validate() {
		var measureUnitCode = document.getElementById("measureUnitCode");
		var measureUnitName = document.getElementById("measureUnitName");
		var rates = document.getElementById("rates");
		var groupName = document.getElementById("groupName");
		
		if (!isNotNull(measureUnitCode, '代码')
				|| !f_check_NumOrLett(measureUnitCode, '代码') || !f_check_ZhOrNumOrLett(measureUnitCode, '代码'))
			return false;
		
		if (!isNotNull(measureUnitName, '名称') || !f_check_ZhOrNumOrLett(measureUnitName, '名称'))
			return false;
		
		if (!isNotNull(rates, '换算率') || !f_check_number(rates, '换算率'))
			return false;
			if (!isNotNull(groupName, '类别'))
			return false;
		
		
	}
	function showList() {
		window.location.href("showMeasureList.action");
	}
</script>
	</head>

	<body>

		<div id="info_all" style="width: 294px;">
			<div id="info_top">
				<s:text name="计量单位"></s:text>
			</div>
			<s:form action="editMeasure.action" method="post" theme="simple"
				onsubmit="return validate()">
				<div
					style="padding: 4px; width: 280px; height: 180px; margin-top: 6px;">
					<!-- 信息显示栏 -->
					<table
						style="margin-top: 10px; background: #fbfbfb; color: #403040;"
						align="center">
						<tr>
							<td>
								<s:text name="代码："></s:text>
							</td>
							<td>
								<s:textfield name="measureunit.measureUnitCode" size="12"
									id="measureUnitCode" maxlength="12"></s:textfield>
								<s:hidden name="measureunit.measureUnitId"></s:hidden>
							</td>
						</tr>
						<tr>
							<td>
								<s:text name="名称："></s:text>
							</td>
							<td>
								<s:textfield name="measureunit.measureUnitName" size="12"
									id="measureUnitName" maxlength="12"></s:textfield>
							</td>
						</tr>
						<tr>
							<td>
								<s:text name="换算率："></s:text>
							</td>
							<td>
								<s:textfield name="measureunit.rates" size="12" id="rates" maxlength="9"></s:textfield>
							</td>
						</tr>
						<tr>
							<td>
								<s:text name="类别："></s:text>
							</td>
							<td>
								<s:textfield size="12" id="groupName" readonly="true"
									name="measureunitgroup.measureGroupName" />
								<s:hidden name="measureunit.measureGroupId" id="groupId"></s:hidden>
								<a href="#"
									onclick="openWin('selectMeasureGroup.action','selectStaff',800,600,0);return false;"
									onfocus="this.blur()"><img src="images/lookup.gif"> </a>
							</td>
						</tr>
						<tr>
							<td>
								<s:text name="默认："></s:text>
							</td>
							<td>
								<s:select list="#{'0':'否','1':'是'}" name="measureunit.isdefault"></s:select>
							</td>
						</tr>
						<tr>
							<td align="right">
								<s:submit value="保存" onfocus="this.blur()"
									onmouseover="this.className='btnover'"
									onmouseout="this.className='btnout'" id="btnsize"></s:submit>
							</td>
							<td align="center">
								&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<input type="button" value="返回" onClick="showList()"
									onFocus="this.blur()" onmouseover="this.className='btnover'"
									onmouseout="this.className='btnout'" class="btnsize" />
							</td>
						</tr>
					</table>
				</div>
			</s:form>
		</div>
	</body>
</html>
